package com.example.auth.demo.mapper;

import com.example.auth.demo.domain.auth.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface CustomerServiceMapper {
    // 工单表相关
    void insertWorkOrder(WorkOrder workOrder);
    WorkOrder getWorkOrderById(Long id);
    // CustomerServiceMapper.java
    List<WorkOrder> getAllWorkOrdersByPage(@Param("pageSize") int pageSize, @Param("offset") int offset);
    int getWorkOrderCount();
    void updateWorkOrderStatus(WorkOrder workOrder);
    void deleteWorkOrder(Long id);

    // 知识库表相关
    void insertKnowledgeBase(KnowledgeBase knowledgeBase);
    KnowledgeBase getKnowledgeBaseById(Long id);
    // 添加带分页和排序的查询方法
    List<KnowledgeBase> getAllKnowledgeBasesByPage(
            @Param("offset") int offset,
            @Param("pageSize") int pageSize,
            @Param("orderBy") String orderBy
    );

    // 添加统计总记录数的方法
    int countAllKnowledgeBases();
    void updateKnowledgeBase(KnowledgeBase knowledgeBase);
    void deleteKnowledgeBase(Long id);

    // 玩家补偿表相关
    // 原有方法保持不变
    void insertPlayerCompensation(PlayerCompensation playerCompensation);
    List<PlayerCompensation> getPlayerCompensationsByPlayerId(Long playerId);

    // 新增方法：使用 @Param 注解替代 parameterMap
    List<PlayerCompensation> getAllPlayerCompensationsByPage(
            @Param("playerId") Long playerId,
            @Param("itemType") String itemType,
            @Param("sort") String sort,
            @Param("order") String order,
            @Param("offset") int offset,
            @Param("pageSize") int pageSize
    );

    int countPlayerCompensations(
            @Param("playerId") Long playerId,
            @Param("itemType") String itemType
    );

    void updatePlayerCompensation(PlayerCompensation playerCompensation);
    void deletePlayerCompensation(Long id);


    // 玩家封禁表相关
    void insertPlayerBan(PlayerBan playerBan);
    PlayerBan getPlayerBanById(Long id);
    List<PlayerBan> getPlayerBansByPlayerId(Long playerId);

    // 新增方法
    List<PlayerBan> getAllPlayerBansByPage(
            @Param("playerId") Long playerId,
            @Param("startDate") Date startDate,
            @Param("endDate") Date endDate,
            @Param("sort") String sort,
            @Param("order") String order,
            @Param("offset") int offset,
            @Param("pageSize") int pageSize
    );
    int countPlayerBans(
            @Param("playerId") Long playerId,
            @Param("startDate") Date startDate,
            @Param("endDate") Date endDate
    );
    void updatePlayerBan(PlayerBan playerBan);
    void deletePlayerBan(Long id);

    // 角色及装备锁定表相关
    void insertRoleEquipmentLock(RoleEquipmentLock roleEquipmentLock);
    RoleEquipmentLock getRoleEquipmentLockById(Long id);
    List<RoleEquipmentLock> getRoleEquipmentLocksByRoleId(Long roleId);
    List<RoleEquipmentLock> getRoleEquipmentLocksByEquipmentId(Long equipmentId);
}